<%-- 
    Document   : patienthome
    Created on : Jun 5, 2012, 11:18:06 AM
    Author     : sai
--%>     

<%@page import="javax.xml.ws.Response"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>doctor home </title>
        <link href="style.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript"> </script>  
    </head>
    <body>        
        <div id="header"></div>
        <div id="navigation"><ul>                
                <li><a href="doctorupdate.html">update profile</a></li>                  
            </ul></div>
            <%@page import="java.sql.*,java.io.*,sai.mysql.DriverLoading" %>
            <%!                Statement state, state1;
                ResultSet result, result1;
                int deptid;
                String userid;
                String url, url1;
                String did, uid, doc_name, email, address, mobile, qual, dept;
            %>
    <center>
        <table border="0" style="background:#669d37">            
            <%                
                try {
                    DriverLoading dl = new DriverLoading();
                    state = dl.getStatement();
                    userid = request.getParameter("username");                    
                    url = "select DOCTOR_ID,USERID,DEPT_ID,DOCTOR_NAME,EMAIL,ADDRESS,MOBILE,MAX_QUALIFICATION from `doctor` where userid='" + userid + "'";                    
                    result = state.executeQuery(url);
                    boolean b = result.next();
                    if (b) {
                        did = result.getString(1);
                        uid = result.getString(2);
                        deptid = result.getInt(3);                        
                        doc_name = result.getString(4);
                        email = result.getString(5);
                        address = result.getString(6);
                        mobile = result.getString(7);                        
                        qual = result.getString(8);
                    }
                    url1 = "select dept_name from `department` where dept_id=" + deptid;
                    state1 = dl.getStatement();
                    result1 = state1.executeQuery(url1);
                    boolean b1 = result1.next();
                    if (b1) {
                        String dept = result1.getString(1);
                    }
                    
                } catch (SQLException e) {
                    out.println("Sql exception raised: . ." + e);
                } catch (Exception e) {
                    out.println("Exception raised  . . " + e);
                }
            %>
             <tr>
                <th>welcome Mr:<u><b><%=doc_name%></b></u></th>
                <td ><a href="logout.jsp" style="margin-top:60px;margin-left:300px;">Logout</td>
            </tr>
            <tr>
                <td>Doctor Name:</td>
                <td><%=doc_name%></td>
            </tr>
            <tr>
                <td>Doctor id:</td>
                <td><%=did%></td>
            </tr>     

            <tr>
                <td>u'r user id is:</td>
                <td><%=uid%></td>
            </tr>
            <tr>
                <td>Email address:</td>
                <td><%=email%></td>
            </tr>
            <tr>
                <td>Address:</td>
                <td><%=address%></td>
            </tr>
            <tr>
                <td>Mobile:</td>
                <td><%=mobile%></td>
            </tr>
            <tr>
                <td>Qualification:</td>
                <td><%=qual%></td>
            </tr>
            <tr>
                <td>Department:</td>
                <td><%=dept%></td>
            </tr>
        </table>
        <%                 
            String id = null;
            try {
                String userid1 = request.getParameter("username");                     
                String url = "select doctor_id from `doctor` where userid='" + userid1 + "'";
                DriverLoading dl1 = new DriverLoading();
                Statement st = dl1.getStatement();                     
                ResultSet result1 = st.executeQuery(url);
                boolean b = result1.next();
                if (b) {
                    id = result1.getString(1);
                }
                out.println(id);
                     
                String url1 = "select hosp_name,location,fromtime,totime from `hospital` where doctor_id='" + id + "'";
                Statement st2 = dl1.getStatement();
                ResultSet rs = st2.executeQuery(url1);
                boolean b1 = rs.next();
                if (b1) {
                    String s1 = rs.getString(1);
                    String s2 = rs.getString(2);
                    Integer i1 = Integer.parseInt(rs.getString(3));
                    Integer i2 = Integer.parseInt(rs.getString(4));
                    out.println("                                                   Hosp name    location   from    to<br>");
                    out.println("<input type='checkbox' name='accept' id='accept'>" + "---" + s1 + "---" + s2 + "---" + i1 + "---" + i2 + "</input>");
                } else {
                    out.println("<center> not present</center>");
                }                     
            } catch (Exception e) {
                out.println(e);
                     
            }
        %>
    </center>
</body>
</html>

